package siac.com.util;

import javax.faces.model.SelectItem;

public class JSFComboBox {
	public JSFComboBox() {
	}
    
    public static SelectItem[] getCBVazia() {
        SelectItem[] items = {new SelectItem(null, "<seleccionar>")};
        return items;
    }
    

	/*
    
    public static SelectItem[] getCBLocPais(List<LocPais> entities, boolean selectOne) {
        int size = selectOne ? entities.size() + 1 : entities.size();
        SelectItem[] items = new SelectItem[size];
        int i = 0;
        if (selectOne) {
            items[0] = new SelectItem(null, "---");
            i++;
        }
        for (LocPais x : entities) {
            items[i++] = new SelectItem(x.getIdPais(), x.getCode() + " - " + x.getPais());
        }
        return items;
    }
	
	public static SelectItem[] getSelectItems(Long id, boolean selectOne) {
        int size = selectOne ? entities.size() + 1 : entities.size();
        SelectItem[] items = new SelectItem[size];
        int i = 0;
        if (selectOne) {
            items[0] = new SelectItem("", "---");
            i++;
        }
        LocPaisDAO dao = new LocPaisDAO();
    	List<LocPais> lista = dao.findAll(id);
    	if(lista.size() > 0){
    		items.add(new SelectItem("*", "Todos"));
    		for(int i=0; i<lista.size(); i++){
    			Issue item = lista.get(i);
    			items.add(new SelectItem(item.getIssueID(), item.getIsin()));
    		}
    	}
		return items;
    }
	public ArrayList<SelectItem> getCBParticipante() {
		ArrayList<SelectItem> items = new ArrayList<SelectItem>();
		items.add(new SelectItem("-", "<seleccionar>"));
		ParticipanteDAO dao = new ParticipanteDAO();
    	List<Participante> lista = dao.findAll();
    	if(lista.size() > 0){
    		items.add(new SelectItem("*", "Todos"));
    		for(int i=0; i<lista.size(); i++){
    			Participante item = lista.get(i);
    			items.add(new SelectItem(item.getParticipanteID(), item.getParticipanteNome()));
    		}
    	}
		return items;
    }
	
	public ArrayList<SelectItem> getCBTipoPgto(String id) {
		ArrayList<SelectItem> items = new ArrayList<SelectItem>();
		items.add(new SelectItem("-", "<seleccionar>"));
		
		for(int i=0; i<tipoPgtoArray.length; i++){
			BeanItem bi = tipoPgtoArray[i];
			if(bi.getIdDescendente().equals(id)){
				items.add(new SelectItem(bi.getIdItem(), bi.getDescricao()));
			}
		}
        return items;
    }
	
	public ArrayList<SelectItem> getCBEmissor() {
		ArrayList<SelectItem> items = new ArrayList<SelectItem>();
		items.add(new SelectItem("-", "<seleccionar>"));
		ParticipanteDAO dao = new ParticipanteDAO();
    	List<Participante> lista = dao.findByRole("Issuer");
    	if(lista.size() > 0){
    		items.add(new SelectItem("*", "Todos"));
    		for(int i=0; i<lista.size(); i++){
    			Participante item = lista.get(i);
    			items.add(new SelectItem(item.getParticipanteID(), item.getParticipanteNome()));
    		}
    	}
		return items;
    }
	
	public ArrayList<SelectItem> getCBTipoPgto(String id) {
		ArrayList<SelectItem> items = new ArrayList<SelectItem>();
		items.add(new SelectItem("-", "<seleccionar>"));
		
		for(int i=0; i<tipoPgtoArray.length; i++){
			BeanItem bi = tipoPgtoArray[i];
			if(bi.getIdDescendente().equals(id)){
				items.add(new SelectItem(bi.getIdItem(), bi.getDescricao()));
			}
		}
        return items;
    }
	
	public ArrayList<SelectItem> getCBMoeda() {
		ArrayList<SelectItem> items = new ArrayList<SelectItem>();
		items.add(new SelectItem("-", "<seleccionar>"));
		MoedaDAO dao = new MoedaDAO();
    	List<Moeda> lista = dao.findAll();
    	if(lista.size() > 0){
    		items.add(new SelectItem("*", "Todas"));
    		for(int i=0; i<lista.size(); i++){
    			Moeda item = lista.get(i);
    			items.add(new SelectItem(item.getMoedaID(), item.getMoedaNome()));
    		}
    	}
		return items;
    }*/

}
